package com.smart.campus.school.service.impl;

import java.util.List;
import com.smart.campus.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.smart.campus.school.mapper.IllegalTypeMapper;
import com.smart.campus.school.domain.IllegalType;
import com.smart.campus.school.service.IIllegalTypeService;
import com.smart.campus.common.core.text.Convert;

/**
 * 违规记录类型Service业务层处理
 * 
 * @author Zhihe.Li
 * @date 2020-05-25
 */
@Service("illegalType")
public class IllegalTypeServiceImpl implements IIllegalTypeService 
{
    @Autowired
    private IllegalTypeMapper illegalTypeMapper;

    /**
     * 查询违规记录类型
     * 
     * @param id 违规记录类型ID
     * @return 违规记录类型
     */
    @Override
    public IllegalType selectIllegalTypeById(Long id)
    {
        return illegalTypeMapper.selectIllegalTypeById(id);
    }

    /**
     * 查询违规记录类型列表
     * 
     * @param illegalType 违规记录类型
     * @return 违规记录类型
     */
    @Override
    public List<IllegalType> selectIllegalTypeList(IllegalType illegalType)
    {
        return illegalTypeMapper.selectIllegalTypeList(illegalType);
    }

    /**
     * 新增违规记录类型
     * 
     * @param illegalType 违规记录类型
     * @return 结果
     */
    @Override
    public int insertIllegalType(IllegalType illegalType)
    {
        illegalType.setCreateTime(DateUtils.getNowDate());
        illegalType.setStatus(1);
        return illegalTypeMapper.insertIllegalType(illegalType);
    }

    /**
     * 修改违规记录类型
     * 
     * @param illegalType 违规记录类型
     * @return 结果
     */
    @Override
    public int updateIllegalType(IllegalType illegalType)
    {
        illegalType.setUpdateTime(DateUtils.getNowDate());
        return illegalTypeMapper.updateIllegalType(illegalType);
    }

    /**
     * 删除违规记录类型对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteIllegalTypeByIds(String ids)
    {
        return illegalTypeMapper.deleteIllegalTypeByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除违规记录类型信息
     * 
     * @param id 违规记录类型ID
     * @return 结果
     */
    @Override
    public int deleteIllegalTypeById(Long id)
    {
        return illegalTypeMapper.deleteIllegalTypeById(id);
    }

    public List<IllegalType> getIllegalType()
    {
        return illegalTypeMapper.selectIllegalTypeList(new IllegalType());
    }
}
